<form method="post" id="tag_form_add" action="<{link app=tags ctl='admin_tags' act=tag_add }>">
<div class="tableform" id="imageset">
    <div class="division">
        <table width="100%" cellspacing="0" cellpadding="0">
        <tbody>
			<tr>
				<th><{t app='tags'}>标签名<{/t}></th>
				<td>
				  <{input type="text" value=$data.tag_name name="tag_name" autocomplete="off"}>
				</td>
			</tr>
			<tr>
				<th><{t app='tags'}>标签备注<{/t}></th>
				<td><{input type="text" value=$data.tag_abbr name="tag_abbr" maxlength="50"}></td>
			</tr>
			<tr>
				<th><label for="dom_el_1d08fb2"><{t app='tags'}>标签字体颜色<{/t}></label></th>
				<td>
				  <{input type='color' name='tag_fgcolor' value=$data.tag_fgcolor|default:'#333333'}>&nbsp;&nbsp;
				  <{if $data.params.tag_showOnIndex}>
				  <{input type="checkbox" name="params[tag_showOnIndex]" checked=checked}>
				  <{else}>
				  <{input type="checkbox" name="params[tag_showOnIndex]"}>
				  <{/if}><{t}>显示到前台<{/t}>
				</td>
			</tr>
			<tr>
				<th><label for="dom_el_1d08fb2"><{t app='tags'}>标签背景颜色<{/t}></label></th>
				<td>
				  <{input type='color' name='tag_bgcolor' value=$data.tag_bgcolor|default:'#eeeeee'}>
				</td>
			</tr>
			<tr>
				<th><{t app='tags'}>显示到小程序标签区域<{/t}></th>
				<td>
					<{if $data.show_small_tag == 1}>
					<{input type="checkbox" name="show_small_tag" checked=checkeds }>
					<{else}>
					<{input type="checkbox" name="show_small_tag" }>
					<{/if}>
					<span style="margin-left: 10px;">
						<span>显示到小程序标签商品区域</span>
					<{if $data.show_small_tag_goods == 1}>
					<{input type="checkbox" name="show_small_tag_goods" checked=checkeds }>
					<{else}>
					<{input type="checkbox" name="show_small_tag_goods" }>
					<{/if}>
					</span>

				</td>
			</tr>
			<tr>
				<th><{t}>小程序自定义标签链接地址：<{/t}></th>
				<td id="ctpl_list">
					<div>
						<label><input name="tag_link_switch" type="radio" value="0"  <{if($data.link_switch==0)}>checked="checked"<{/if}> />关闭</label>
						<label><input name="tag_link_switch" type="radio" value="1" <{if($data.link_switch==1)}>checked="checked"<{/if}>  />开启</label>
						<label style="color: red">*</label>如果开启则标签商品无效
					</div>
				</td>
			</tr>
			<tr id="new_linke" <{if($data.link_switch==1)}>style="display:''";<{else}>style="display: none";<{/if}> >
				<th><{t}>标签跳转新地址：<{/t}></th>
				<td>
					<{input type="test" name="tag_link" value=$data.tag_link }>
				</td>
			</tr>


			<tr>
				<th><{t app='tags'}>标签图片<{/t}></th>
				<td>
					<{input type="image" value=$data.params.tag_image name="params[tag_image]"}>
					<em>建议使用大小为30x30像素的图片。图片过大可能因系统自动压缩图片而导致变形</em>
				</td>
			</tr>
			<tr>
				<th><{t}>排序：<{/t}></th>
				<td><{input type="text" name="params[display_order]" value=$data.params.display_order|default:0 vtype='required&&number' size=4 }></td>
			</tr>
			<tr>
				<th><{t app='tags'}>标签图片透明度<{/t}></th>
				<td>
					 <{input type="number" value=$data.params.tag_opacity|default:100 name="params[tag_opacity]"}><br />
					 <{t app='tags'}>0表示透明，100表示不透明<{/t}>
				</td>
				</tr>
			<tr>
				<th><{t app="tags"}>标签图片位置<{/t}></th>
				<td>
					<table class="pos-select" style="width:auto;">
					  <{input type="hidden" value=$data.params.pic_loc name="params[pic_loc]"}>
					  <tr>
						  <td v="tl"><{t}>左上<{/t}></td>
						  <td v="tr"><{t}>右上<{/t}></td>
					  </tr>
					  <tr>
						  <td v="bl"><{t}>左下<{/t}></td>
						  <td v="br"><{t}>右下<{/t}></td>
					  </tr>
					</table>
				</td>
			</tr>
			<{input type="hidden" value=$data.tag_id name="tag_id"}>
			<{input type="hidden" value=$data.app_id name="app_id"}>
			<{input type="hidden" value=$data.tag_type name="tag_type"}>
        </tbody>
        </table>
        </div>

	<div class="table-action">
        <{button label=$___image="确定"|t:'tags' class="btn-primary" type="submit"}>
    </div>
</div>
</form>
<script>

$ES('.pos-select','imageset').each(function(table){
    var ipt=$E('input',table);
    table.addEvent('click',function(e){
        var target=new Event(e).target;
        if(target.tagName=='TD' && target.get('v')){
            try{$E('td.current',table).removeClass('current')}catch(e){}
            ipt.value=target.get('v');
            target.addClass('current');
        }
    });
    if(ipt.value){
        try{$E('td[v="'+ipt.value+'"]',table).addClass('current');}catch(e){}
    }
});

$('tag_form_add').store('target',{
    onComplete:function(){

        if(finderGroup['<{$env.get.finder_id}>'])
        finderGroup['<{$env.get.finder_id}>'].refresh();

        $('tag_form_add').getParent('.dialog').retrieve('instance').close();
    }

});

$ES('input[type=radio]','ctpl_list').each(function(el,i){
    el.addEvent('click',function(e){
        switch ($(this).value){
            case "1":
                $('new_linke').setStyle('display','')
                break;
            case "0":
                $('new_linke').setStyle('display','none')
                break;
        }
    })
})
</script>
